const IBM = {
	map: {},
	nodeid: '',
	mapConfig: {},
	ibl: '',
	init: function() {
		if (this.ibl && this.ibl.defaultLayer) {
			this.mapConfig.layers = this.ibl.defaultLayer;
		} else {
			this.mapConfig.layers = [];
			console.log('请指定默认显示图层');
		}

		if (this.nodeid) {
			this.map = L.map(this.nodeid, this.mapConfig);
		} else {
			console.log('请设置地图绑定的div元素ID');
		}
		if (this.ibl) {
			var layerControl = L.control.layers(this.ibl.baseLayers || [], this.ibl.overlayLayers || []).addTo(this.map);
			layerControl.setPosition('topleft');

			/* 加载要素图层 */
			var that = this;
			this.ibl.editPolygonLayer.on('load', function(e) {
				for (var index in that.ibl.labels) {
					that.map.addLayer(that.ibl.labels[index]);
				}
			});

			this.ibl.editPolygonLayer.on('addfeature', function(e) {
				var label = that.ibl.labels[e.feature.id];
				if (label) {
					label.addTo(that.map);
				}
			});
			this.ibl.editPolygonLayer.on('removefeature', function(e) {
				var label = that.ibl.labels[e.feature.id];
				if (label) {
					that.map.removeLayer(label);
				}
			});
		}
	}
};
